// pages/xinjian/jiameng/jiameng.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
name:'',
mobile:'',
map:'',
text:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
name(e){
	this.setData({
		name:e.detail.value
	})
},
mobile(e){
	this.setData({
		mobile:e.detail.value
	})
},
map(e){
	this.setData({
		map:e.detail.value
	})
},
text(e){
	this.setData({
		text:e.detail.value
	})
},
sure(){
	if(this.data.text!=''&&this.data.map!=''&&this.data.mobile!=''&&this.data.name!=''){
		wx.getStorage({
			key:'uid',
			success: (e) => {
				wx.request({
					url: getApp().globalData.xc,
					method: "POST",
					header: {
						"Content-Type": "application/x-www-form-urlencoded"
					},
					data: {
						HTTP_API: 'vv/jiameng/api/index/applyJoin',
						name:this.data.name,
						mobile:this.data.mobile,
						address:this.data.map,
						content:this.data.text,
						token:e.data.uid
					},
					success:(e)=>{
						console.log(e)
						if(e.data.code==1){
							wx.navigateBack({
								delta:1
							})
						}else{
							wx.showToast({
								title:'提交信息错误',
								icon:'none'
							})
						}
					}
				})
			}
		})
	}else{
		wx.showToast({
			icon:'none',
			title:'请正确填写详细信息'
		})
	}
}
})